package com.zzx.es;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;

import java.io.IOException;

/**
 * @ClassName: com.zzx.es.ESTest_Client
 * @Description: ES访问测试类
 * @Author zhouzhixin
 * @Date 2021/8/13
 * @Version 1.0
 */
public class ESTest_Client {
    public static void main(String[] args) {
        try {
            //连接ES客户端
            RestHighLevelClient client = new RestHighLevelClient(
                    RestClient.builder(new HttpHost("127.0.0.1", 9200, "http"))
            );
            //关闭ES客户端
            client.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
